let map = new Map();
map.set('Template',() => import('@/views/home/template/Template.vue'));
map.set('Index',() => import('@/views/home/index/Index.vue'));
map.set('Myproject',() => import('@/views/home/project/Myproject.vue'));
map.set('Projectjoin',() => import('@/views/home/project/Projectjoin.vue'));
map.set('Batch',() => import('@/views/home/batch/Batch.vue'));
map.set('Error',() => import('@/views/error/error.vue'));

export function getRoutes(menus) {
    let actionRouter = [];
    menus.map(item => {
      if (item.children != null && item.children.length > 0) {
        let children=[];
        item.children.map(tips=>{
          children.push({
            path:tips.path,
            name:tips.name,
            component:map.get(tips.name),
          });
        });
   
        actionRouter.push({
          path:item.path,
          name:item.name,
          component:map.get(item.name),
          children,
        });
      }else {
        actionRouter.push({
          path:item.path,
          name:item.name,
          component:map.get(item.name),
          children:[]
        });
      }
    });
    return actionRouter;
  }

export default getRoutes;